home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Internet Tools 1993 July / Internet Tools.iso / RockRidge / mail / metamail / contrib / ServiceMail / src / dspd / dspd.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-05-09  |  3.5 KB  |  119 lines

  1. /*Copyright (c)  1993 Enterprise Integration Technologies Corporation
  2.  
  3. Permission to use, copy, modify, distribute, and sell this software and
  4. its documentation for any purpose is hereby granted without fee, provided
  5. that (i) the above copyright notices and this permission notice appear in
  6. all copies of the software and related documentation, and (ii) the name of
  7. Enterprise Integration Technologies Corporation may not be used in any
  8. advertising or publicity relating to the software without the specific,
  9. prior written permission of Enterprise Integration Technologies Corporation.
  10.  
  11. THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
  12. EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
  13. WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
  14.  
  15. IN NO EVENT SHALL ENTERPRISE INTEGRATION TECHNOLOGIES CORPORATION  BE
  16. LIABLE FOR ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF
  17. ANY KIND, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
  18. PROFITS, WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY
  19. THEORY OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  20. PERFORMANCE OF THIS SOFTWARE.
  21. */
  22. #include <stdio.h>
  23. #include <sys/param.h>
  24. #include <sys/types.h>
  25. #include <dirent.h>
  26. #include <sys/stat.h>
  27. #include <signal.h>
  28. #include <sys/wait.h>
  29. #include <sys/time.h>
  30. #include <sys/resource.h>
  31. #include <fcntl.h>
  32. #include "errors.h"
  33.  
  34. /*Site configuration stuff....(for building).*/
  35. #ifdef USEVFORKH
  36. #include <vfork.h>
  37. #endif
  38.  
  39. #define USESIGINTERRUPT
  40.  
  41. #ifdef NOSIGINTERRUPT
  42. #undef USESIGINTERRUPT
  43. #endif
  44.  
  45. #define NAMELEN 20        
  46. /*You shouldn't have to edit anything past this line*/
  47.  
  48. #define PIDFILE ".dsp.pid"
  49. #define MESH_PATH "mesh"
  50. #define DOWNHEAP k=1;\
  51.         while(k<=(size/2))\
  52.         {\
  53.            j=k+k;\
  54.            if(j<size && (nicecmp(msgplist[j],msgplist[j+1])<0)) j++;\
  55.            if(nicecmp(new,msgplist[j])>=0) break;\
  56.            msgplist[k]=msgplist[j]; k=j;\
  57.         }\
  58.         msgplist[k]=new;
  59.  
  60. #define MAX_MESHES 20
  61. #define QUEUESIZE 1000
  62. static int sleepwhenempty=300;
  63. static int queuetime=300;
  64. static int killtime=600;
  65. static time_t nextscanat;
  66. static int maxmeshes=5;
  67. static int meshes=0;
  68. static int halt=0;
  69. static int rund=0;
  70. static int queuesize=1000;
  71. static int prival=1;
  72. static int timeval=0;
  73. static int facility=LOG_LOCAL6;
  74. static int logfac=6;
  75. static int nounlink=0;
  76. static int totalmsgs;
  77. static uid_t uid;
  78. static gid_t gid;
  79. static char spooldir[MAXPATHLEN]; /*If you don't have this, take a guess...*/
  80. static char executable[MAXPATHLEN];
  81. extern char *optarg;
  82.  
  83. int readok();
  84. int sigbogo();
  85. int sighalt();
  86. int procwait();
  87.  
  88. struct errinfo
  89. {
  90.   char *msg;
  91.   int level;
  92.   int status;
  93. };
  94.  
  95. struct errinfo err[]={
  96.   {"Unable to stat: ",LOG_ALERT,SYSTEM},
  97.   {"Unable to open directory for reading: ",LOG_EMERG,FATAL|SYSTEM},
  98.   {"Unable to fork() or vfork() ",LOG_ALERT,SYSTEM},
  99.   {"Unable to exec() ",LOG_EMERG,SYSTEM},
  100.   {"Unable to kill timed-out processing of: ",LOG_EMERG,SYSTEM},
  101.   {"Unable to remove: ",LOG_EMERG,SYSTEM},
  102.   {"File remained after processing. Erased: ",LOG_INFO,NULL},
  103.   {"File remained after processing. Could not remove: ",LOG_EMERG,SYSTEM},
  104.   {"Error during wait3() for processes. ",LOG_ALERT,SYSTEM},
  105.   {"Error creating PID record. Job control will not work. ",LOG_ALERT,SYSTEM},
  106.   {"Error deleting PID record. ",LOG_EMERG,SYSTEM}
  107. };
  108.  
  109. struct dirdat {
  110.   char d_name[NAMELEN];
  111.   struct stat buf;
  112. } *msgplist[QUEUESIZE];
  113.  
  114. struct {
  115.   pid_t pid;
  116.   char d_name[NAMELEN];
  117.   time_t starttime;
  118. } procdata[MAX_MESHES];
  119.